package com.miracle.flexAPI.api.service.impl;

import com.ruoyi.common.core.domain.AjaxResult;
import com.miracle.flexAPI.api.entity.SysCacheConfig;
import com.miracle.flexAPI.api.mapper.SysCacheConfigMapper;
import com.miracle.flexAPI.api.service.SysCacheConfigService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

import lombok.extern.slf4j.Slf4j;

import java.util.List;

/**
 * 缓存配置表(SysCacheConfig)表服务实现类
 *
 * @author miracle
 * @since 2021-09-03 10:41:18
 */
@Slf4j
@Service
public class SysCacheConfigServiceImpl implements SysCacheConfigService {
    @Resource
    private SysCacheConfigMapper sysCacheConfigMapper;


    /**
     * 查询列表
     *
     * @param model 实例对象
     * @return 对象列表
     */
    @Override
    public AjaxResult list(SysCacheConfig model) {
        List<SysCacheConfig> list = this.sysCacheConfigMapper.queryByDto(model);
        return AjaxResult.success(list);
    }

    /**
     * 新增数据
     *
     * @param model 实例对象
     * @return 实例对象
     */
    @Override
    public AjaxResult add(SysCacheConfig model) {
        int result = this.sysCacheConfigMapper.insertByModel(model);
        return AjaxResult.success(result);
    }

    /**
     * 修改数据
     *
     * @param model 实例对象
     * @return 实例对象
     */
    @Override
    public AjaxResult edit(SysCacheConfig model) {
        int result = this.sysCacheConfigMapper.updateByModel(model);
        return AjaxResult.success(result);
    }

    /**
     * 删除数据
     *
     * @param model 实例对象
     * @return 删除数量
     */
    @Override
    public AjaxResult delete(SysCacheConfig model) {
        int result = this.sysCacheConfigMapper.deleteByModel(model);
        return AjaxResult.success(result);
    }
}
